﻿Public Class ReportExplorer
    Inherits ExplorerTreeList

    Public GroupMenuID As Guid
    Private DocumentTemplatePL As PLBase

    Public Sub New(ByVal aQueryName As String, Optional ByVal SecureExplorer As Boolean = False)
        MyBase.New(aQueryName, SecureExplorer)
        'AddHandler InitTreeActionOptionList, AddressOf Init_TreeActionOptionList
    End Sub

    Public Sub New()
        MyBase.New()
        'AddHandler InitTreeActionOptionList, AddressOf Init_TreeActionOptionList
    End Sub

    Public Overrides Sub PopulateDetailSection()
        Me.Cursor = Cursors.WaitCursor
        '
        If aGridControl IsNot Nothing Then
            aGridControl.Dispose()
            aGridControl = Nothing
        End If
        '
        If FocusedNodeLevel = 0 Then
            ShowAllDocumentTemplate_ByGroup()

            For Each aFrm As XtraForm In Me.ParentForm.MdiChildren
                If aFrm.Name = PanelName Then
                    aFrm.Controls.Clear()
                    aFrm.Controls.Add(aGridControl)
                    aFrm.Show()
                    aFrm.Focus()
                End If
                aFrm.Refresh()
            Next
        End If

        Me.Cursor = Cursors.Default
    End Sub

    ''' <summary>
    ''' This sub shows the list of Report by group
    ''' </summary>
    Public Overridable Sub ShowAllDocumentTemplate_ByGroup()
        DocumentTemplatePL = PLBase.CreateInstanceOf(PLTypeOf.DocumentTemplate_PL, "DocumentTemplateList")
        DocumentTemplatePL.SQLWhere = String.Format("GroupId_FK = '{0}'", GroupMenuID)
        aGridControl = New GridExtPL() With {.Dock = DockStyle.Fill, .Pl = DocumentTemplatePL, .SecureGrid = True, .Name = "Report List", .FormCtrlCD = Nothing}
        aGridControl.AllowCreate = False
        aGridControl.AllowDelete = False
        aGridControl.AllowUpdate = False
    End Sub

   

    Private Sub ReportExplorer_Load(sender As Object, e As EventArgs) Handles Me.Load
        TreeActionOptionListLoad()
        MetaControlTreeListActionOptionList.ApplySecurity()
    End Sub
End Class
